package com.hzcx.app.simplechat.ui.setting.presenter;

import android.app.Activity;
import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.base.BaseEmptyBean;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.bean.UpLoadImgBean;
import com.hzcx.app.simplechat.model.PublicModel;
import com.hzcx.app.simplechat.model.SettingModel;
import com.hzcx.app.simplechat.model.UserModel;
import com.hzcx.app.simplechat.ui.setting.bean.BlackListBean;
import com.hzcx.app.simplechat.ui.setting.contract.AddAutoSendMsgContract;
import com.hzcx.app.simplechat.ui.setting.contract.BlackListContract;
import com.hzcx.app.simplechat.util.token.TokenUtils;

import java.util.List;

public class AddAutoSendMsgPresenter extends BasePresenter<AddAutoSendMsgContract.View> implements AddAutoSendMsgContract.Presenter {

    /**
     *  添加自动回复消息
     * @param context
     * @param type
     * @param content
     * @param image
     * @param id
     */
    @Override
    public void addAutoChatMessage(Context context, int type, String content, String image, String id) {
        SettingModel.addAutoSendMsg(context, type, content, image, id, new BaseDialogObserver<BaseEmptyBean>(context) {
            @Override
            protected void onSuccess(BaseEmptyBean data) {
                mView.addSuccess();
            }
        });
    }

    /**
     *  上传图片
     * @param activity
     * @param path
     */
    @Override
    public void upLoadImg(Activity activity, String path) {
        PublicModel.upLoadImg(activity, TokenUtils.getTokenHeader(), path, new BaseDialogObserver<UpLoadImgBean>(activity) {
            @Override
            protected void onSuccess(UpLoadImgBean data) {
                mView.imgLoadResult(data.getUrl());
            }
        });
    }
}
